package com.example.demo.service;

import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * @ClassName AsyncService
 * @Author bsy
 * @Description TODO
 * @Date 2022/8/9 23:34
 * @Version 1.0
 */
@Component
public class AsyncService {

    //告诉Spring这是一个异步方法,SpringBoot就会自己开一个线程池，进行调用！
    @Async
    public void hello(){
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("业务进行中....");
    }
}
